package com.学生案例2;

import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.Map;

@WebServlet("/query")
public class queryDemo extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=UTF-8");
        BufferedReader br = new BufferedReader(new FileReader("/Users/eddie/workspace/java/work/My_servlet1/src/com/学生案例2/a.txt"));
        String line;
        PrintWriter writer = resp.getWriter();
        while ((line = br.readLine()) != null){
            writer.write(line);
            writer.write("<br>");
            writer.flush();
        }
        br.close();
        writer.close();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
